package com.fone.player.billing.bean;

import java.io.InputStream;

import android.text.TextUtils;

import com.fone.player.util.L;

public class VIPProtocBean extends PYBaseBean {

	private String rqUrl;
	private String type;

	public String getRqUrl() {
		return rqUrl;
	}

	public void setRqUrl(String rqUrl) {
		this.rqUrl = rqUrl;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Override
	public Object parseXml(InputStream ins) {
		// TODO Auto-generated method stub
		return null;
	}

	public VIPProtocBean getVipPro(String payProtocolInfo) {
		VIPProtocBean vipProtocBean = null;
		if (TextUtils.isEmpty(payProtocolInfo)) {
			return null;
		}
		String rqUrl = "";
		String type = "";

		vipProtocBean = new VIPProtocBean();
		if (payProtocolInfo.contains("error")) {
			L.i("获取登录用户的计费策略失败", payProtocolInfo);
			return null;
		} else {
			if (payProtocolInfo.contains("rqurl")) {
				rqUrl = payProtocolInfo.substring(0,
						payProtocolInfo.indexOf("</rqurl>"));
				rqUrl = rqUrl.substring(rqUrl.lastIndexOf(">") + 1,
						rqUrl.length());
				L.i("获取登录用户的计费策略:", rqUrl);
			}
			if (payProtocolInfo.contains("type")) {// type 2 xml type 1 webview
				type = payProtocolInfo.substring(0,
						payProtocolInfo.indexOf("</type>"));
				type = type.substring(type.lastIndexOf(">") + 1, type.length());
				L.i("获取登录用户的计费策略类型:", type);
			}
			if (null != vipProtocBean) {
				vipProtocBean.setRqUrl(rqUrl);
				vipProtocBean.setType(type);
			}

			// if(FoneConstants.FEE_PAGE_WEBVIEW.equals(type)){
			// return rqUrl;
			// }else if(FoneConstants.FEE_PAGE_XML.equals(type)){
			//
			// }else{
			// L.i("计费中心下发计费页面类型错误", type);
			// }
			return vipProtocBean;
		}
	}
}
